/*
 * VectorUtility.h
 *
 *      Author: Jerome RD Soine and Christoph A Brand
 *      Institution: Schwarz goup, Institute for Theoretical Physics, Heidelberg University, Germany
 */

#ifndef VectorOperations_H_
#define VectorOperations_H_


#include <vector>
//#include <printf.h>
#include <fstream>

using namespace std;

/*!
 * Utility class that provides basic operations applied to vector objects.
 */

class VectorOperations
{
public:
	/*!
	 * Adds a scalar value to a vector.
	 */
	static void add_to_std_vector(double, std::vector<double>, std::vector<double>&);
	/*!
	 * Subtracts a scalar value to a vector.
	 */
	static void subtract_from_std_vector(double, std::vector<double>, std::vector<double>&);
	/*!
	 * Multiplies a scalar value to a vector.
	 */
	static void scale_std_vector(double,std::vector<double>&);
	/*!
	 * Normalizes a vector.
	 */
	static void normalize_vector(std::vector<double>&);
	/*!
	 * Returns the L2 value of a vector.
	 */
	static double get_L2_of_std_vector(std::vector<double> v);
	/*!
	 * Compares to vectors and returns the maximal component difference.
	 */
	static double max_component_difference(std::vector<double>, std::vector<double> v2);
	/*!
	 * Returns the scalar product of two vectors.
	 */
	static double scalar_product(std::vector<double>,std::vector<double>);
	/*!
	 * Flips a vector by changing all signs of the components.
	 */
	static void change_sign_of_std_vector(std::vector<double> & v);
	/*!
	 * Writes vector content to standard output device.
	 */
	static void cout_std_vector(std::vector<double> & v);
	/*!
	 * Writes vector content to file stream.
	 */
	static void data_out_std_vector(std::ofstream & , std::vector<double> & v);
	/*!
	 * Get maximal vector component value
	 */
	static double get_max_component(std::vector<double> & v);
	/*!
	 * Get minimal vector component value
	 */
	static double get_min_component(std::vector<double> & v);

};


#endif /* VectorOperations_H_ */
